package cn.dapeng;

import lombok.Getter;
import lombok.Setter;

import java.lang.reflect.Constructor;

@Getter
@Setter
public class Student extends Person {

    private int id;
    private String name;

    public Student() {
    }

    public Student(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                '}';
    }

    public static void main(String[] args) {
        Class<Student> studentClass = Student.class;

        try {
            Constructor<Student> x = studentClass.getConstructor(Integer.class, String.class);

            Student student = x.newInstance(1, "dapeng");

            System.out.println(student);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}
